<template>
  <div class="app-container">
    <el-table
      v-loading="listLoading"
      :data="list"
      style="width: 100%"
      row-key="id"
      border
    >
      <el-table-column
        prop="name"
        label="角色名称"
      />
      <el-table-column
        prop="code"
        label="角色标识"
      />
      <el-table-column label="操作" width="100" align="center">
        <template slot-scope="{row}">
          <el-button type="success" @click="setFormData(row)">选择 </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { GetSystemRoleList } from '@/api/SystemManagerApi'
export default {
  data() {
    return {
      title: '编辑角色',
      listLoading: false,
      list: []
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      GetSystemRoleList().then(response => {
        this.list = response.data
        this.listLoading = false
      })
    },
    setFormData(row) {
      this.$emit('selectedRole', row)
    }
  }
}
</script>
